Skip to content

Conversation

@roomote
Copy link

@roomote roomote bot commented Oct 2, 2025

Description

This PR attempts to address Issue #8474 by adding support for the Grok 4 Fast model in the xAI provider.

Changes

  • Added grok-4-fast model configuration to xaiModels in packages/types/src/providers/xai.ts
    • 30,000 max tokens
    • 2,000,000 token context window
    • Pricing: .0 input / .0 output per million tokens
  • Added test case to verify the model selection works correctly

Testing

  • ✅ All existing tests pass
  • ✅ Added new test case for grok-4-fast model selection
  • ✅ Linting and type checking pass

Related Issue

Fixes #8474

Notes

The model parameters (context window, max tokens, pricing) are based on the configuration already present in the Roo provider models. This enables users with xAI accounts to directly select and use Grok 4 Fast.

Feedback and guidance are welcome!


Important

Add grok-4-fast model to xAI provider with specific parameters and test for correct model selection.

  • Behavior:
    • Add grok-4-fast model to xaiModels in xai.ts with 2,000,000 token context window, 8192 max tokens, and specific pricing.
    • New test in xai.spec.ts verifies grok-4-fast model selection.
  • Testing:
    • All existing tests pass.
    • New test case for grok-4-fast model selection added and passes.

This description was created by Ellipsis for 7bea3b1. You can customize this summary. It will automatically update as commits are pushed.

- Added grok-4-fast model configuration to xaiModels in packages/types/src/providers/xai.ts
- Added test case to verify grok-4-fast model selection works correctly
- Model includes 2M context window and 30K max tokens support

Fixes #8474
@roomote roomote bot requested review from cte, jr and mrubens as code owners October 2, 2025 21:16
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. enhancement New feature or request labels Oct 2, 2025
@roomote
Copy link
Author

roomote bot commented Oct 2, 2025

Beginning a full review now - I will add inline comments shortly.

roomote[bot]

This comment was marked as outdated.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Oct 2, 2025
…xAI specs

- Fix inputPrice from .0 to /bin/sh.20 per million tokens
- Fix outputPrice from .0 to /bin/sh.50 per million tokens
- Update maxTokens from 30,000 to 8,192 (matching grok-4, as xAI doesn't publish max output limit)
- Remove subjective 'SOTA cost-efficiency' wording from description
@roomote
Copy link
Author

roomote bot commented Oct 27, 2025

Review Summary

I found 1 critical issue that needs to be addressed:

  • Test Assertion Mismatch: Update test expectation for maxTokens from 30_000 to 8192 to match the actual model configuration

Follow Along on Roo Code Cloud

expect(model.id).toBe(testModelId)
expect(model.info).toEqual(xaiModels[testModelId])
expect(model.info.contextWindow).toBe(2_000_000)
expect(model.info.maxTokens).toBe(30_000)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test expects maxTokens to be 30_000 but the model configuration (line 32 in xai.ts) defines it as 8192. This mismatch was introduced when the second commit updated the pricing and maxTokens but didn't update the test. The test will fail when run.

Suggested change
expect(model.info.maxTokens).toBe(30_000)
expect(model.id).toBe(testModelId)
expect(model.info).toEqual(xaiModels[testModelId])
expect(model.info.contextWindow).toBe(2_000_000)
expect(model.info.maxTokens).toBe(8192)

The test was expecting 30,000 maxTokens but we corrected this to 8,192 to match grok-4, as xAI doesn't publish a maximum output token limit for grok-4-fast.
Copy link
Author

@roomote roomote bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found.

@daniel-lxs daniel-lxs closed this Oct 27, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Oct 27, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Oct 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:S This PR changes 10-29 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] Add Grok 4 Fast to xAI Provider

4 participants